package com.hd.appcommon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hd.appcommon.entity.SchoolClass;
import com.hd.appcommon.entity.User;
import com.hd.appcommon.entity.vo.SchoolClassVo;
import com.hd.appcommon.mapper.SchoolClassMapper;
import com.hd.appcommon.mapper.UserMapper;
import com.hd.appcommon.service.SchoolClassService;
import com.hd.hdxgddcommon.page.MyPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SchoolClassServiceImpl extends ServiceImpl<SchoolClassMapper, SchoolClass> implements SchoolClassService {
    @Autowired
    SchoolClassMapper schoolClassMapper;
    @Autowired
    UserMapper userMapper;
    @Override
    public IPage<SchoolClassVo> listClassByPage(MyPage page,QueryWrapper<SchoolClass> queryWrapper) {
//        IPage<SchoolClassVo> schoolClassVoIPage=schoolClassMapper.listClassByPage(page,queryWrapper);
//        for (SchoolClassVo schoolClassVo:schoolClassVoIPage.getRecords()){
//            if (schoolClassVo.getJobNumber()==null){
//                continue;
//            }
//            schoolClassVo.setTeaName(userMapper.selectOne(new QueryWrapper<User>().eq("job_number",schoolClassVo.getJobNumber())).getName());
//        }
        return schoolClassMapper.listClassByPage(page,queryWrapper);
    }
}
